import React from 'react'
import xiuer from './xiuer.jpg'
import user from './user.jpg'

class ChatNews extends React.Component{

    constructor(props){
        super(props)
    }
    render(){
        return(
            <div className={this.props.content.type} id={this.props.id}>
                <img src={this.props.content.type=='robot'?xiuer:user}/>
                <span>
                    {this.props.content.content}
                    {
                        this.props.content.type=='user'?<span></span>:''
                    }
                </span>
            </div>
        )
    }
    componentDidMount(){
        $('.chat-container').scrollTop($('.chat-container')[0].scrollHeight)
    }
}

export default ChatNews